for I in `grep -i $BL /tmp/streamtmp | grep -i $WL | sed "s#\&#\g" | sed -n "s#.*name=\"\([^\"]*\)\".*id=\"\([0-9]*\)\".*#\1_TAG_\2#p"|sed "s#\ #_#g"`; do
DIR="$BASEDIR/SHOUTcast TV"
[ ! -d "$DIR" ] && mkdir -p "$DIR"
FILE="$(echo $I | sed -e "s#\(.*\)_TAG_[0-9]*#\1#" | sed -e "s#_# #g" -e "s#://##g" -e "s#/# #g")"
URL="$SC_TUNE?id=$(echo $I | sed -e "s#.*_TAG_\(.*\)#\1#")"
echo "$URL" > "$DIR/$FILE.pls" &> /dev/null
done
fi
# extended m3u playlists
unset FILE URL
for J in `grep "^EXTM3U" /etc/netstream | sed "s# #%20#g"`; do
DIR="$BASEDIR/$(echo $J | sed -e "s#^EXTM3U=\".*\":\(.*\)#\1#" -e "s#%20# #g")"
M3UURL="$(echo $J | sed "s#^EXTM3U=\"\(.*\)\":.*#\1#")"